<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="wap/common::head"></head>
<body class="layui-layout-body">
<link type="text/css" rel="stylesheet" th:href="@{/css/main.css}"/>
<style>
	html,body{
		height:100%;
	}
	table.nine-grid{border-collapse: collapse;width: 100%}
	table.nine-grid tr td{border-collapse: collapse;border: none;width: 33%; text-align: center;}
	table.nine-grid tr td a{display: block;margin: 5px;height: 100px;color: #fff; position: relative;cursor: pointer; box-shadow: 0px 0px 5px #999;}
	table.nine-grid tr td img{margin-top: 18px; margin-bottom: 10px;max-width: 40%}
	table.nine-grid tr td a .mtname{ position: absolute; left: 5px;bottom:5px;   z-index: 10}

	.tdt-control-copyright{display: none}
	.tdt-control-container .tdt-top{bottom:30px;top: auto;}
	#controller li,.controlbutton{float: left; background-image: linear-gradient(#019ee3, #011e9c);border-radius:0;line-height: 45px;border-right: 1px solid #011e9c}
	#controller li div{display: none;font-size: 14px;}
	#controller li:hover div{display: block}
	#controller li:hover i{display: none}
	#controller li i{ font-size: 22px;}
	.droneMenu{position: absolute;left: 5px;top:5px; z-index: 9999}
	.droneMenu  a{width:60px; height: 60px; display: block;background: #333; margin-top:2px;position:relative; text-align: center;color:#fff;}
	.droneMenu  a i{font-size:24px; color: #fff; line-height: 50px; display: block}
	.droneMenu  a div{color: #fff;line-height: 30px; width: 100%; text-align: center;position: absolute;z-index: 1000;bottom: 0px;font-size: 14px;  }
	.droneMenu  a:hover{opacity:0.85}
	.droneUncheck{ background-image: linear-gradient(#019ee3, #011e9c);border-radius:0;padding:0 20px; line-height: 40px; text-align: center;color: #fff;}
	.droneCheck{ background-image: linear-gradient(#289949, #56ef0b);border-radius:0;padding:0 20px; line-height: 40px; text-align: center;color: #fff;}
	.people-li{ font-size: 12px; width: 100%; border-bottom: 1px solid #ccc;float: left;clear: both;line-height: 30px; padding:5px 0 }
	.people-li div{float: left}
	.people-li img{ width: 25px; height: 25px;margin-right: 5px; margin-left: 5px}
</style>
<div class="waptit">
	<div class="waptitname">
		<a  th:href="@{${@hostConfig.DRONE_PORTAL}}"><i class="layui-icon layui-icon-left"></i>无人机</a>

		</div>
</div>
<div th:replace="wap/common::crane"></div>
<div style="margin: 5px;margin-top: 60px; position: absolute;top: 50%;display: block;width: calc(100% - 20px);margin-top: -300px">
	
	
	<div id="container"></div>
	
	<ul id="droneList"  style="right: 15px; top: 60px; overflow: hidden;z-index: 888;position: fixed;   background:rgb(255,255,255,0.7);box-shadow: 0 0 5px #ccc; ">
	</ul>
	
	<div class="droneMenu">
		<a href="javascript:void(0);" onclick="droneTakeoff();" class="droneli" style="background: #00a8ec"><i class="layui-icon layui-icon-location" ></i><div>起飞</div></a>
		<a href="javascript:void(0);" onclick="droneLand();" class="droneli" style="background: #c1b317"><i class="layui-icon layui-icon-survey" ></i><div>降落</div></a>
	</div>
	
	<div id="missionContainer" style="position: absolute;left:90px;top: 300px;z-index: 1000;background-color: #fff;padding: 5px;display: none;">
		<table id="missionList" class='layui-table statable' lay-size='sm' lay-skin="line" style="margin-bottom: 0px;">
		</table>
	</div>
	
	<div class="droneConsole" style="position: absolute;bottom: 0px;left: 0px;width: 365px;height: 200px;z-index: 1000;">
		<div id="console01" class="layui-card" style="width: 100%;height: 200px;float: left;display: none;">
	        <div class="layui-card-header">01 号机 最高速 (<font color="darkblue" id="maxspeed01"></font>米/秒)  <font color="darkred" id="mission01">未装载任务</font> 进度 (<font color="darkblue" id="missionPercent01">0%</font>)</div>
	        <div class="layui-card-body">
	        	<table class='layui-table statable' lay-size='sm' lay-skin="line">
	        		<tr>
	        			<td >飞行模式 : </td>
	        			<td ><p id="flightmode01"></p></td>
	        			<td >电池容量 : </td>
	        			<td ><p id="battery01">100%</p></td> 
	        		</tr>
	        		<tr>
	        			<td>当前经度 : </td>
	        			<td><p id="positionLng01"></p></td>
	        			<td>当前纬度 : </td>
	        			<td><p id="positionLat01"></p></td>
	        		</tr>
	        		<tr>
	        			<td>当前高度 : </td>
	        			<td><p id="positionAbs01"></p></td>
	        			<td>健康状态 : </td>
	        			<td><p id="health01"></p></td>
	        		</tr>
	        		<tr>
	        			<td>Landed : </td>
	        			<td><p id="landedstate01"></p></td>
	        			<td>VtolState : </td>
	        			<td><p id="vtolstate01"></p></td>
	        		</tr>
	        	</table>
	        </div>
	    </div>
	    <div id="console02" class="layui-card" style="width: 100%;height: 200px;float: left;margin-right: 10px;display: none;">
	        <div class="layui-card-header">02 号机 最高速 (<font color="darkblue" id="maxspeed02"></font>米/秒)  <font color="darkred" id="mission02">未装载任务</font> 进度 (<font color="darkblue" id="missionPercent02">0%</font>)</div>
	        <div class="layui-card-body">
	        	<table class='layui-table statable' lay-size='sm' lay-skin="line">
	        		<tr>
	        			<td >飞行模式 : </td>
	        			<td ><p id="flightmode02"></p></td>
	        			<td >电池容量 : </td>
	        			<td ><p id="battery02">100%</p></td> 
	        		</tr>
	        		<tr>
	        			<td>当前经度 : </td>
	        			<td><p id="positionLng02"></p></td>
	        			<td>当前纬度 : </td>
	        			<td><p id="positionLat02"></p></td>
	        		</tr>
	        		<tr>
	        			<td>当前高度 : </td>
	        			<td><p id="positionAbs02"></p></td>
	        			<td>健康状态 : </td>
	        			<td><p id="health02"></p></td>
	        		</tr>
	        		<tr>
	        			<td>Landed : </td>
	        			<td><p id="landedstate02"></p></td>
	        			<td>VtolState : </td>
	        			<td><p id="vtolstate02"></p></td>
	        		</tr>
	        	</table>
	        </div>
	    </div>
	    <div id="console03" class="layui-card" style="width: 100%;height: 200px;float: left;margin-right: 10px;display: none;">
	        <div class="layui-card-header">03 号机 最高速 (<font color="darkblue" id="maxspeed03"></font>米/秒)  <font color="darkred" id="mission03">未装载任务</font> 进度 (<font color="darkblue" id="missionPercent03">0%</font>)</div>
	        <div class="layui-card-body">
	        	<table class='layui-table statable' lay-size='sm' lay-skin="line">
	        		<tr>
	        			<td >飞行模式 : </td>
	        			<td ><p id="flightmode03"></p></td>
	        			<td >电池容量 : </td>
	        			<td ><p id="battery03">100%</p></td> 
	        		</tr>
	        		<tr>
	        			<td>当前经度 : </td>
	        			<td><p id="positionLng03"></p></td>
	        			<td>当前纬度 : </td>
	        			<td><p id="positionLat03"></p></td>
	        		</tr>
	        		<tr>
	        			<td>当前高度 : </td>
	        			<td><p id="positionAbs03"></p></td>
	        			<td>健康状态 : </td>
	        			<td><p id="health03"></p></td>
	        		</tr>
	        		<tr>
	        			<td>Landed : </td>
	        			<td><p id="landedstate03"></p></td>
	        			<td>VtolState : </td>
	        			<td><p id="vtolstate03"></p></td>
	        		</tr>
	        	</table>
	        </div>
	    </div>
		<div id="console04" class="layui-card" style="width: 100%;height: 200px;float: left;margin-right: 10px;display: none;">
	        <div class="layui-card-header">04 号机 最高速 (<font color="darkblue" id="maxspeed04"></font>米/秒)  <font color="darkred" id="mission04">未装载任务</font> 进度 (<font color="darkblue" id="missionPercent04">0%</font>)</div>
	        <div class="layui-card-body">
	        	<table class='layui-table statable' lay-size='sm' lay-skin="line">
	        		<tr>
	        			<td >飞行模式 : </td>
	        			<td ><p id="flightmode04"></p></td>
	        			<td >电池容量 : </td>
	        			<td ><p id="battery04">100%</p></td> 
	        		</tr>
	        		<tr>
	        			<td>当前经度 : </td>
	        			<td><p id="positionLng04"></p></td>
	        			<td>当前纬度 : </td>
	        			<td><p id="positionLat04"></p></td>
	        		</tr>
	        		<tr>
	        			<td>当前高度 : </td>
	        			<td><p id="positionAbs04"></p></td>
	        			<td>健康状态 : </td>
	        			<td><p id="health04"></p></td>
	        		</tr>
	        		<tr>
	        			<td>Landed : </td>
	        			<td><p id="landedstate04"></p></td>
	        			<td>VtolState : </td>
	        			<td><p id="vtolstate04"></p></td>
	        		</tr>
	        	</table>
	        </div>
	    </div>
	</div>
		
	
	
</div>




<script type="text/javascript" th:src="${@mapConfig.SRC}"></script> 
<script type="text/javascript">

var websocket= new WebSocket("/websocket");

$(function(){

	var promise = new Promise(function(resolve,reject){
		
		layer.msg('拉取数据中,请稍候......', { icon: 16, shade: 0.5,shadeClose:false});	
		
	    setTimeout(() => {
	    	
	    	///加载结束判断websocket状态
			var intercount=0;
			var interval=setInterval(() => {
			
				if (websocket.readyState === WebSocket.OPEN ) {
					console.log("websocket open-> "+websocket.readyState+" times-> "+intercount)
					clearInterval(interval);
					resolve();
				} else {
					if(intercount>=1800){
						console.log("websocket exception -> "+websocket.readyState+" times-> "+intercount)
						clearInterval(interval);
						location.reload();
					}
					console.log("websocket wait-> "+websocket.readyState+" times-> "+intercount)
				}
				
				intercount++;
			      
			}, 100);
	    	
	    });
	});

	promise.then(function(){
		
		websocket.onmessage = function(msg){
			if(msg.data=="heart"){
				//console.log("monitor 心跳消息 : "+msg.data);
				return ;
			}
			var message=JSON.parse(msg.data);
			//console.log(message.type+"_"+message.name)
			window[message.type+"_"+message.name](message.target,message.data);
		};
		
		websocket.onclose = function() {
			console.log("monitor socket 被关闭,30秒后刷新页面 ");
			setTimeout(function(){ 
				location.reload();
			},'30000');
		};
		
		setInterval(function() {
		    if (websocket.readyState == 1) {
		    	websocket.send("heart");
		    } else{
		    	console.log("websocket 发送 heart 被断开")
		    	websocket= new WebSocket("/websocket");
		    	console.log("websocket 发送 heart 重连接")
		    }
		}, 30 * 1000);
		
		layer.closeAll();
		
		console.log("websocket 注册完毕")
	});
	
	promise.then(function(){
		
		//加载任务列表
		var result=json("/mission/collect",{"sortField":"misSort","sortOrder":"true"});
		$("#missionList").empty();
		for(let i in result.resultList){
			let m=result.resultList[i];
			$("#missionList").append("<tr><td id='"+m.misNo+"' style='cursor:pointer;' onclick='droneMissionUpload(\""+m.misNo+"\",\""+m.misName+"\");'>装载任务 ("+m.misName+")</td><td style='cursor:pointer;color:blue;' onclick='location.href=\"arrange?misNo="+m.misNo+"\"'>查看</td></tr>");
		}
		
		//要状态
		for(var i=0;i<10;i++){
			let id=i.toString().padStart(2, '0');
			var cmd={"id":guid(),"type":"cmd","name":"status","target":id,"data":{}};
			websocket.send(JSON.stringify(cmd));
		}
		
		
	});
	
})

</script>



<script type="text/javascript">
$("#container").css({"width":$(window).width()-10+"px","height":$(window).height()-55+"px"});

var map = null;
var mapLng="[[${@mapConfig.LNG}]]";
var mapLat="[[${@mapConfig.LAT}]]";
var mapZoom="[[${@mapConfig.ZOOM}]]";

$(function(){
	
	map = new T.Map("container");
	map.centerAndZoom(new T.LngLat(mapLng, mapLat), mapZoom);
	var ctrl = new T.Control.MapType();
	map.addControl(ctrl);
	map.setMapType(TMAP_HYBRID_MAP);
	
	var menu = new T.ContextMenu({
	       width: 120
	});
	var mi1 = new T.MenuItem("驶向此处", droneGoto);
	menu.addItem(mi1);
	var mi2 = new T.MenuItem("标记此处", mapMark);
	menu.addItem(mi2);
	
	map.addContextMenu(menu);
     
     
})


</script>

<script type="text/javascript">

var droneGroup=new Array();
var missionList=null;

function msg_status(target,param){
	
	console.log("新终端加入 : "+ target)
	
	if($("#droneList").find('[value=\"'+target+'\"]').length==0){
		$("#droneList").append("<li class='droneUncheck' style='cursor:pointer;' value='"+target+"' onclick='clientSelect(this);'>无人机 "+target+" 号</li>");
	}
    createMarker(target,"drone",mapLng,mapLat);
    
    //要位置
	var cmd={"id":guid(),"type":"cmd","name":"position","target":target,"data":{}};
	websocket.send(JSON.stringify(cmd));
	
	//要飞行模式
	var cmd={"id":guid(),"type":"cmd","name":"flightmode","target":target,"data":{}};
	websocket.send(JSON.stringify(cmd));
	
	//要最高速
	var cmd={"id":guid(),"type":"cmd","name":"maxspeed","target":target,"data":{}};
	websocket.send(JSON.stringify(cmd));
	
	//要初始点位信息
	var cmd={"id":guid(),"type":"cmd","name":"home","target":target,"data":{}};
	websocket.send(JSON.stringify(cmd));
	
	//要任务信息信息
	var cmd={"id":guid(),"type":"cmd","name":"missionDownload","target":target,"data":{}};
	websocket.send(JSON.stringify(cmd));
	
}

function msg_position(target,param){
	var lays=map.getOverlays();
	for(var i=0;i<lays.length;i++){
		if(lays[i].id=="drone_"+target){
			map.removeOverLay(lays[i]);
		}
	}
	createMarker(target,"drone",param.lng,param.lat);
	$("#positionLng"+target).text(param.lng);
	$("#positionLat"+target).text(param.lat);
	$("#positionAbs"+target).text(param.abs);
}

function msg_flightmode(target,param){
	$("#flightmode"+target).text(param.flightmode);
}

function msg_maxspeed(target,param){
	$("#maxspeed"+target).text(param.maxspeed);
}

function msg_home(target,param){
	createMarker(target,"home",param.lng,param.lat);
}

function msg_health(target,param){
	
	let homeposition="位置正常";
	let armable="待机正常";
	if(param.homeposition=="0"){
		homeposition="位置异常";
		armable="待机异常";
	}
	
	$("#health"+target).text(homeposition +" "+armable);
}

function msg_battery(target,param){
	if(Number.isNaN(param.battery)||param.battery=='NaN'){
		$("#battery"+target).text("100%");
	}else{
		$("#battery"+target).text(param.battery);
	}
}

function msg_landedstate(target,param){
	$("#landedstate"+target).text(param.landedstate);
}

function msg_vtolstate(target,param){
	$("#vtolstate"+target).text(param.vtolstate);
}

function msg_goto(target,param){
	layer.msg("驶向指令发送成功");
}

function msg_takeoff(target,param){
	layer.msg("起飞指令发送成功");
}

function msg_land(target,param){
	layer.msg("降落指令发送成功");
}

function msg_altitude(target,param){
	layer.msg("定高设置成功");
}

function msg_return(target,param){
	layer.msg("返航指令发送成功");
}

function msg_missionUpload(target,param){
	layer.msg(target +"任务上传中 : " +(Number(param.percent)*100).toFixed(2) +" %");
	//上传完毕开始下载任务
	if(Number(param.percent==1)){
		var cmd={"id":guid(),"type":"cmd","name":"missionDownload","target":target,"data":{}};
		websocket.send(JSON.stringify(cmd));
	}
}

function msg_missionDownload(target,param){
	if(param&&param.length>1){
		layer.msg(target +"任务下载完成,线路绘制..");
		
		let html="<div  class='layui-btn-group'>";
		html+="<button class='layui-btn layui-btn-sm' onclick='droneMissionStart(\""+target+"\");'>启动</button> ";
		html+="<button class='layui-btn layui-btn-sm' onclick='droneMissionCanel(\""+target+"\");'>取消</button> ";
		html+="</div>";
	
		$("#mission"+target).html("已装载任务 "+html).css("color","darkblue");
		
		taskClear(target);
		
		let line=new Array();
		for(let i in param){
			let task=param[i];	
			let lnglat=new T.LngLat(task.longitudeDeg,task.latitudeDeg);
			line.push(lnglat);
			
			var icon = new T.Icon({
		        iconUrl: "/images/mission/"+i.toString().padStart(2, '0')+".png",
		        iconSize: new T.Point(40, 40),
		        iconAnchor: new T.Point(10, 25)
		    });
		    var marker = new T.Marker(lnglat, {icon: icon});
		    marker.id="mission_mark_"+target;
		    map.addOverLay(marker);
		}
		
		let polyline=new T.Polyline(line);
		polyline.id="mission_line_"+target;
	    map.addOverLay(polyline);
	}
}

function msg_missionStart(target,param){
	if(Number.isNaN(param.percent)||param.percent=='NaN'||param.percent==-1){
		layer.msg("任务启动失败");
	}else{
		layer.msg("任务启动成功");
		$("#missionPercent"+target).text((Number(param.percent)*100).toFixed(2) +" %");
	}
}

function msg_missionCanel(target,param){
	layer.msg("任务撤销成功");
	$("#mission"+target).html("未装载任务").css("color","darkred");
	$("#missionPercent"+target).text(" 0%");
	
	taskClear(target);
}

function createMarker(target,type,lng,lat){
	var icon = new T.Icon({
        iconUrl: "/images/"+type+"/"+target+".png",
        iconSize: new T.Point(40, 40),
        iconAnchor: new T.Point(10, 25)
    });
    var marker = new T.Marker(new T.LngLat(lng, lat), {icon: icon});
    marker.id=type+"_"+target;
    marker.lng=lng;
    marker.lat=lat;
    map.addOverLay(marker);
}

function mapMark(e){
	var icon = new T.Icon({
        iconUrl: "/images/mark.png",
        iconSize: new T.Point(40, 40),
        iconAnchor: new T.Point(10, 25)
    });
    var marker = new T.Marker(new T.LngLat(e.lng, e.lat), {icon: icon});
    map.addOverLay(marker);
}

function taskClear(target){
	var lays=map.getOverlays();
	for(var i=0;i<lays.length;i++){
		if(lays[i].id==("mission_line_"+target)||lays[i].id==("mission_mark_"+target)){
			map.removeOverLay(lays[i]);
		}
	}
}

function clientSelect(obj){
	let id=$(obj).attr("value");
	
	if($(obj).attr("class")=="droneUncheck"){
		$(obj).attr("class","droneCheck");
		droneGroup.push(id);	
		var lays=map.getOverlays();
		for(var i=0;i<lays.length;i++){
			if(lays[i].id==("drone_"+id)){
				map.panTo(new T.LngLat(lays[i].lng, lays[i].lat))
			}
		}
		$("#console"+id).show();
	}else{
		$(obj).attr("class","droneUncheck");
		droneGroup.splice(droneGroup.indexOf($(obj).attr("value")), 1);
		$("#console"+id).hide();
	}
}

function missionSelect(){
	var missionList=jsonAsync("/mission/collect",{"sortField":"misSort","sortOrder":"true"},function(result){
		$("#missionList").empty();
		for(let i in result.resultList){
			let m=result.resultList[i];
			$("#missionList").append("<li id='"+m.misNo+"' class='missionList' style='cursor:pointer;' onclick='missionChose(\""+m.misNo+"\");'>"+m.misName+"</li>");
		}
	})
}
	

</script>


<script type="text/javascript">

	function droneGoto(e){
		
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			layer.prompt({formType:0,value: '5',title: '请输入速度(米/秒)',maxlength: 50},function(value, index, elem){
				if(!value||Number.isNaN(value)){
					value=0;
				}
				for(let i in droneGroup){
					let cmd={"id":guid(),"type":"cmd","name":"goto","target":droneGroup[i],"data":{"speed":value,"lng":e.lng,"lat":e.lat}};
					websocket.send(JSON.stringify(cmd));
				}
				layer.closeAll();
	  		});
			
		});
	}

	function droneTakeoff(){
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			layer.prompt({formType:0,value: '5',title: '请输入起飞高度(米)',maxlength: 50},function(value, index, elem){
				if(!value||Number.isNaN(value)){
					value=0;
				}
				for(let i in droneGroup){
					let cmd={"id":guid(),"type":"cmd","name":"takeoff","target":droneGroup[i],"data":{"alt":value}};
					websocket.send(JSON.stringify(cmd));
				}
				layer.closeAll();
	  		});
		});
		
	}
	
	function droneLand(){
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			for(let i in droneGroup){
				let cmd={"id":guid(),"type":"cmd","name":"land","target":droneGroup[i],"data":{}};
				websocket.send(JSON.stringify(cmd));
			}
			layer.closeAll();
		});
	}
	
	function droneAltitude(){
		
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			layer.prompt({formType:0,value: '',title: '请输入上升或下降的高度(米),下降则负数',maxlength: 50},function(value, index, elem){
				if(!value||Number.isNaN(value)){
					value=0;
				}
				for(let i in droneGroup){
					let cmd={"id":guid(),"type":"cmd","name":"altitude","target":droneGroup[i],"data":{"alt":value}};
					websocket.send(JSON.stringify(cmd));
				}
				layer.closeAll();
	  		});
		});
	}
	
	function droneReturn(){
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			for(let i in droneGroup){
				let cmd={"id":guid(),"type":"cmd","name":"return","target":droneGroup[i],"data":{}};
				websocket.send(JSON.stringify(cmd));
			}
		});
	}
	function droneToggle(){
		$("#missionContainer").toggle();
	}
	function droneMissionUpload(misNo,misName){
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		$("#missionContainer").hide();
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端上传 ( '+misName+' ) 任务,是否确定?', {icon: 3, title:'提示'}, function(index){
			
			jsonAsync("/mission/grab",{"misNo":misNo},function(result){
			    for(let i in droneGroup){
					let cmd={"id":guid(),"type":"cmd","name":"missionUpload","target":droneGroup[i],"data":JSON.parse(result.misData)};
					websocket.send(JSON.stringify(cmd));
				}
			    
			})
		});
	}
	function droneMissionStart(target){
		layer.confirm('对当前选定的'+target+'启动任务,是否确定?', {icon: 3, title:'提示'}, function(index){
			let cmd={"id":guid(),"type":"cmd","name":"missionStart","target":target,"data":{}};
			websocket.send(JSON.stringify(cmd));
			layer.closeAll();
		});
	}
	function droneMissionCanel(target){
		layer.confirm('对当前选定的'+target+'取消任务,是否确定?', {icon: 3, title:'提示'}, function(index){
			let cmd={"id":guid(),"type":"cmd","name":"missionCanel","target":target,"data":{}};
			websocket.send(JSON.stringify(cmd));
			layer.closeAll();
		});
	}
	function droneCalibrate(){
		
	}
	function droneCamera(){
		if(droneGroup.length==0){
			layer.msg("未选中任何设备");
			return;
		}
		
		layer.confirm('对当前选定的'+droneGroup.length+'个终端执行操作,是否确定?', {icon: 3, title:'提示'}, function(index){
			layer.msg("仿真设备无法拍摄");
		});
	}
	function droneLog(){
		layer.msg("最新日志下载进行中...请登录FTP查看");
	}
	
	function droneArrange(){
		location.href="/arrange";
	}
	
</script>

<script th:replace="wap/common::tail"></script>
</body>
</html>





